<template>
<el-row class="disease">
    <el-breadcrumb class="doctor-top">
        <el-breadcrumb-item>疾病管理</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="doctor-mid">
		<el-form :model="diForm">
			<el-row :gutter="20">
					<el-col :span="5">
						<el-form-item label="疾病名称" label-width="68px">
						<el-input v-model="diForm.disName" autocomplete="off" placeholder="请选择疾病名称" style="width: 140px;"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="5">
						<el-form-item label="一级科室" label-width="68px">
						<el-select v-model="firstKe" placeholder="请选择一级科室" style="width: 150px;" @change="departRender">
							<el-option
							v-for="item in diForm.depFirstKe" :key="item.value"
							:label="item.label"
							:value="item.value"
							></el-option>
						</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="5">
						<el-form-item label="二级科室" label-width="68px">
						<el-select v-model="secondKe" placeholder="请选择二级科室" style="width: 150px;">
							<el-option
							v-for="item in diForm.depSecondKe" :key="item.value"
							:label="item.label"
							:value="item.value"
							></el-option>
						</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="5">
						<el-form-item label="部位" label-width="68px">
						<el-select v-model="position" placeholder="请选择部位" style="width: 150px;">
							<el-option
							v-for="item in diForm.body" :key="item.value"
							:label="item.label"
							:value="item.value">
							</el-option>
						</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="4">
						<el-button type="primary" size="mini" style="width: 80px; margin-top: 4px;" @click="diSearch">搜索</el-button>
					</el-col>
			</el-row>
		</el-form>
    </div>
    <el-row style="margin: 10px 0;">
            <el-col :span="8"><el-button type="primary" size="mini" style="width: 80px;" @click="disFrame()">新增</el-button></el-col>
    </el-row>
    <template>
        <!--
          column-type  selection多选/index索引/expand折叠行
          data   数据
          columns  表头
          columns-props 公共的属性
          columnsSchema   单独定义 columns 的某一列
          columnsHandler 操作

          column-type="index"
        -->
        <egrid class="egrid"
          stripe border
          v-loading="loading"
          size="mini"
          :header-cell-style="{color:'#333'}"
          :data="data"
          :columns="columns"
          :columns-props="columnsProps"
          :columns-schema="columnsSchema"
          :columns-handler="columnsHandler"
          @selection-change="selectionChange">
        </egrid>
        <!--
              current-page  当前页
              page-sizes    当前页条数选择
              page-size     当前页条数
              total         总数
              sizeChange    每页条数选择的方法
              currentChange 当前页条数选择的方法
        -->
        <Pagination
          :current-page=this.searchBean.pageNum
          :page-sizes="[10,20,30]"
          :page-size=this.searchBean.pageSize
          :total=this.searchBean.total
          @sizeChange="sizeChange"
          @currentChange="currentChange"
          >
        </Pagination>
    </template>

      <!-- 新增疾病弹框 -->
    <el-dialog :title="addEdit==0?'新增疾病': '编辑疾病'" width="45%" :visible.sync="diNewDialogVisible" center :show-close="showClose">
        <el-col>基本信息</el-col>
      <el-form :model="diNewForm" :rules="rules" ref="ruleForm">
        <el-row :gutter="20" style="margin: 18px 0;">
            <el-col :span="10">
                <el-form-item label="名称" label-width="50px" prop="rulesName">
                    <el-input v-model="diNewForm.diNewName" autocomplete="off" style="width: 140px;"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="10">
                <el-form-item label="部位" label-width="40px">
                  <el-select v-model="newPosition" placeholder="请选择部位名称" style="width: 160px;">
                     <el-option
                        v-for="item in diNewForm.newBody" :key="item.value"
                        :label="item.label"
                        :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
            </el-col>
        </el-row>
        <el-row :gutter="20" style="margin: 4px 0;">
            <el-col :span="10">
                <el-form-item label="一级科室" label-width="68px">
                    <el-select v-model="newFirstKe" placeholder="请选择一级科室名称" style="width: 160px;" @change="firstTwoTan">
                        <el-option
                        v-for="item in diNewForm.firstNewKe" :key="item.value"
                        :label="item.label"
                        :value="item.value">
                    	</el-option>
                  </el-select>
                </el-form-item>
            </el-col>
            <el-col :span="10">
                <el-form-item label="二级科室" label-width="68px">
                  <el-select v-model="newSecondNewKe" placeholder="请选择二级科室名称" style="width: 160px;">
                    <el-option
                        v-for="item in diNewForm.secondNewKe" :key="item.value"
                        :label="item.label"
                        :value="item.value">
                    	</el-option>
                  </el-select>
                </el-form-item>
            </el-col>
			<el-col :span="4">
				 <el-button type="primary" @click="addDepart" size="mini" style="width: 50px; margin-top: 6px;">添加</el-button>
			</el-col>
        </el-row>
		 <el-row :gutter="20" style="margin: 4px 0;" v-for="(item, index) in twoLevelDeptIds" :key="index">
            <el-col :span="10">
                <el-form-item label="一级科室" label-width="68px">
                    <el-select v-model="newFirstKe" placeholder="请选择一级科室名称" style="width: 160px;" @change="firstTwoTan">
                        <el-option
                        v-for="item in diNewForm.firstNewKe" :key="item.value"
                        :label="item.label"
                        :value="item.value">
                    	</el-option>
                  </el-select>
                </el-form-item>
            </el-col>
            <el-col :span="10">
                <el-form-item label="二级科室" label-width="68px">
                  <el-select v-model="newSecondNewKe" placeholder="请选择二级科室名称" style="width: 160px;">
                    <el-option
                        v-for="item in diNewForm.secondNewKe" :key="item.value"
                        :label="item.label"
                        :value="item.value">
                    	</el-option>
                  </el-select>
                </el-form-item>
            </el-col>
			<el-col :span="4">
				 <el-button type="primary" @click="deDepart(index)" size="mini" style="width: 50px; margin-top: 6px;">删除</el-button>
			</el-col>
        </el-row>
      </el-form>
       <el-row style="margin-top: 10px;">
        <el-col :span="8">症状</el-col>
        <el-col :offset="10" :span="4">
          <span @click="firstAdd" style="cursor:pointer; color: #409EFF;">添加</span>&nbsp;&nbsp;&nbsp;
          <span style="cursor:pointer; color: #409EFF;" @click="dtRemove(domain)">删除</span>
        </el-col>
      </el-row>
      <div class="doctorOpenBing">
          	<el-checkbox-group v-model="diNewForm.goodAt">
				<el-checkbox v-for="item in firstItem" :label="item.name" :key="item.name" @change="firstChange(item)">{{item.name}}</el-checkbox>
			</el-checkbox-group>
      </div>
      <div>
        <el-button type="primary" @click="diNewDialogVisible = false" size="mini" style="width: 80px; margin-left: 180px;">取 消</el-button>
        <el-button type="primary" @click="disAddEidt" size="mini" style="width: 80px; margin-left: 100px;">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 新增症状弹框 -->
    <el-dialog title="胸外科" :visible.sync="diSecondDialog" width="20%"
      :show-close="showClose" class="abow_dialog"
      modal-append-to-body
      center
      ref="newTan">
      <el-row>
        <el-form :model="diNewDe"  class="fix">
            <el-form-item>
                <el-input placeholder="请输入症状名称" v-model="diNewDe.newNames" @blur="blur"
                style="width:110%;" clearable>
                </el-input>
            </el-form-item>
        </el-form>
        <el-row class="fixDown">
			<el-col>
                   <el-checkbox-group v-model="seconedSyCheckList">
						<el-checkbox v-for="item in seconedGoodSympton" :label="item.name" :key="item.name" style="display: block;" @change="seconedChange(item)">{{item.name}}</el-checkbox>
					</el-checkbox-group>
                </el-col>
		</el-row>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="addDepartDis" size="mini" style="width: 80px;">添加</el-button>
        <el-button type="primary" @click="diSecondDialog = false" size="mini" style="width: 80px;  margin-left: 20px;">取 消</el-button>
      </span>
    </el-dialog>
</el-row>
</template>
<script>
import API from '../../api/api_yxc';
import Pagination from '../tableComponents/pagination';
// 操作按钮
var Btn = {
  template: `<div><el-button type="primary" @click="details" style="padding:6px;">编辑</el-button>
  <el-button type="primary" @click="detail" style="padding:6px;">删除</el-button>
  </div>`,
  props: ['row'],
  methods: {
    details() {
      this.$emit('row-editor', this.row);
    },
    detail() {
      this.$emit('row-remove', this.row);
    }
  }
};
// 单元格的组件
var Editor = {
  template:
  '<div>{{ text ? text : "-" }}</div>',
  props: ['row', 'col'],
  computed: {
    text () {
      return this.row[this.col.prop]
    }
  }
};
// 部位
let diseaseType = {
  template:
	'<div>{{diseaseType}}</div>',
  props: ['row', 'col'],
  computed: {
    diseaseType() {
      // console.log(this.row)
      // console.log(this.col)
      switch (this.row.partId) {
      case 0:
        this.row[this.col.label] = '头部';
        break;
      case 1:
        this.row[this.col.label] = '胸部';
        break;
      case 2:
        this.row[this.col.label] = '上肢';
        break;
      case 3:
        this.row[this.col.label] = '腹部';
        break;
      case 4:
        this.row[this.col.label] = '下肢';
        break;
      case 5:
        this.row[this.col.label] = '颈部';
        break;
      case 6:
        this.row[this.col.label] = '骨';
        break;
      case 7:
        this.row[this.col.label] = '腰部';
        break;
      case 8:
        this.row[this.col.label] = '盆腔';
        break;
      case 6:
        this.row[this.col.label] = '骨';
        break;
      case 7:
        this.row[this.col.label] = '臀部';
        break;
      case 8:
        this.row[this.col.label] = '盆腔';
        break;
      case 9:
        this.row[this.col.label] = '臀部';
        break;
      case 10:
        this.row[this.col.label] = '男性生殖';
        break;
      case 11:
        this.row[this.col.label] = '女性生殖';
        break;
      case 12:
        this.row[this.col.label] = '皮肤';
        break;
      default:
        this.row[this.col.label] = '-';
      }
      return this.row[this.col.label];
    }
  }
}
// 二级科室
let HospitalType = {
  template:
	'<div>{{hospitalType}}</div>',
  props: ['row', 'col'],
  computed: {
    hospitalType() {
      // console.log(this.row)
      // console.log(this.col)
      if (this.row.twoLevelDeptNames[0]) {
        // this.row[this.col.label]='头部';
        return this.row[this.col.label] = this.row.twoLevelDeptNames[0];
      } else {
        return '-';
      }
    }
  }
}
export default {
  components: {
      	Pagination
  },
  data() {
    const checkName = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('症状名称不能为空'));
      }
      const check = /^[\u4e00-\u9fa5_a-zA-Z0-9_]{0,20}$/;
      if (!check.test(value)) {
        callback(new Error('请输入20位以内的数字字母英文'));
      } else {
        callback();
      }
    }
    return {
      position: '', // 部位,
      newPosition: '', // 新添加部位,
      firstKe: '', // 第一科室
      newFirstKe: '', // 新添加第一科室
      newSecondNewKe: '', // 新添加第二科室
      secondKe: '', // 二级科室
      diForm: {
        disName: '',
        depSecondKe: [],
        depFirstKe: [{
          value: '全部',
          label: '全部'
        }],
        body: [{
          value: '0',
          label: '头部'
        }, {
          value: '1',
          label: '胸部'
        }, {
          value: '2',
          label: '上肢'
        }, {
          value: '3',
          label: '腹部'
        }, {
          value: '4',
          label: '下肢'
        }, {
          value: '5',
          label: '颈部'
        }, {
          value: '6',
          label: '骨'
        }, {
          value: '7',
          label: '腰部'
        }, {
          value: '8',
          label: '盆腔'
        }, {
          value: '9',
          label: '臀部'
        }, {
          value: '10',
          label: '男性生殖'
        }, {
          value: '11',
          label: '女性生殖'
        }, {
          value: '12',
          label: '皮肤'
        }]
      },
      // 弹框不展示关闭按钮
      showClose: false,
      diNewDialogVisible: false, // 第一个弹框
      diSecondDialog: false, // 第二个弹框
      // 表格区域
      loading: true,
      columns: [
        { label: '疾病名称', prop: 'name' },
        { label: '二级科室', prop: 'twoLevelDeptId' },
        { label: '部位', prop: 'partId' }
      ],
      data: [],
      // columnsProps 用于定义所有 columns 公共的属性
      columnsProps: {
        component: Editor,
        align: 'center'
        // sortable: true
      },
      // columnsSchema 可以用来单独定义 columns 的某一列这里的设置会覆盖 columnProps 的配置属性
      columnsSchema: {
        // '序号':{width: '50',align:'center'},
			  // '订单号':{width: '180'},
			  '部位': {
				  component: diseaseType
			  },
			  '二级科室': {
				  component: HospitalType
			  }
      },
      // 查询参数
      searchBean: {
        partId: null, // 部位id
			  twoLevelDeptId: '', // 二级科室id
			  name: '', // 疾病名称
        pageNum: 1,
			  pageSize: 10,
			  total: 1,
        oneLevelDeptId: ''
          	},
      checked: false,
      // 添加症状弹框
      diNewForm: {
        goodAt: [],
        secondNewKe: [],
        firstNewKe: [{
          value: '全部',
          label: '全部'
        }],
        newBody: [{
          value: '0',
          label: '头部'
        }, {
          value: '1',
          label: '胸部'
        }, {
          value: '2',
          label: '上肢'
        }, {
          value: '3',
          label: '腹部'
        }, {
          value: '4',
          label: '下肢'
        }, {
          value: '5',
          label: '颈部'
        }, {
          value: '6',
          label: '骨'
        }, {
          value: '7',
          label: '腰部'
        }, {
          value: '8',
          label: '盆腔'
        }, {
          value: '9',
          label: '臀部'
        }, {
          value: '10',
          label: '男性生殖'
        }, {
          value: '11',
          label: '女性生殖'
        }, {
          value: '12',
          label: '皮肤'
        }],
        diNewName: ''
      },
        	// 第二个弹框
          	diNewDe: {
              	newNames: ''
		  	},
      // 验证
      rules: {
        diNewName: [
          { validator: checkName, trigger: 'blur' }
        ]
      },
      addEdit: '', // 0 为新增 1 为编辑
      diseaseId: '', // 疾病id
      firstGoodDisease: [], // 所有擅长疾病，第一个弹框
      diseaseIdName: [], // 选中的擅长疾病，第二个弹框
      diseases: [], // 最终传给后台
      deleteItemId: [], // 删除的id
      deleteName: [], // 准备要删除的数组，id，name，选中状态
      deleteId: [], // 准备要删除id，选中状态
      seconedGoodSympton: [], // 所有擅长症状 第二个弹框
      seconedSyCheckList: [], // 选中的 第二个
      firstItem: [], // 选中第一个
      twoLevelDeptIds: []
    }
  },
  mounted() {
		  this.loadPage();
		  this.oneDepartList();
  },
  methods: {
    loadPage() {
      let that = this;
      API.searchDisease(this.searchBean).then(function(result) {
        console.log(result)
        if (result.status != '0') {
          that.$message.error({
            showClose: true,
            message: result.message.toString(),
            duration: 2000
          });
          return;
        }
        that.searchBean.total = result.data.total;
        that.data = result.data.list;
        that.loading = false;
		  }, function(err) {
        that.$message.error({
          showClose: true,
          message: err.message.toString(),
          duration: 2000
        });
        console.log(err)
        that.loading = false;
		  }
		  ).catch(function(error) {
        console.log(error);
        that.$message.error({
          showClose: true,
          message: '请求出现异常',
          duration: 2000
        });
        that.loading = false;
      })
    },
    // 一级科室
    departSearch() {
		   let that = this;
		   let search = {
        oneLevelDeptId: this.firstKe, // 一级科室id
        pageNum: 1,
        pageSize: 10
      };
      API.deptQueryList(search).then(function(result) {
        console.log(result);
        if (result.status != '0') {
          that.$message.error({
            showClose: true,
            message: result.message.toString(),
            duration: 2000
          });
        }
      }, function(err) {
        that.$message.error({
          showClose: true,
          message: err.message.toString(),
          duration: 2000
        });
        console.log(err)
        that.loading = false;
      }).catch(function(error) {
        console.log(error)
        that.$message.error({
          showClose: true,
          message: error.message.toString(),
          duration: 2000
        });
        that.loading = false;
      })
    },
    // 科室渲染
    departRender() {
      this.departSearch();
    },
    // 疾病搜索
    diSearch() {
      this.searchBean.name = this.diForm.disName;
      this.searchBean.partId = this.position; // 部位
      this.searchBean.twoLevelDeptId = this.secondKe;
      this.loadPage();
      console.log(this.secondKe)
      console.log(this.position)
    },
    // 表格
    columnsHandler(cols) {
      let that = this;
      return cols.concat({
        label: '操作',
        align: 'center',
        width: 180,
        component: Btn,
        listeners: {
          'row-editor'(row) {
            // console.log(row)
            that.disFrame(row) // 进入编辑，调用这个方法
          },
          'row-remove'(row) {
            that.diseaseDelete(row.id)
          }
        }
      });
    },
    // 表格，多选肝功能
    selectionChange(rows) {
      // console.log(rows);
    },
      	// 分页  每页
    sizeChange(val) {
      // console.log(val)
      this.searchBean.pageSize = val;
      // this.searchBean.pageNum = 1;
      this.loadPage()
    },
    // 当前页
    currentChange(val) {
      // console.log(val)
      this.searchBean.pageNum = val;
      this.loadPage()
    },
    // 弹框中的删除
    addRmove() {

    },
    // 显示新增编辑疾病页面
    disFrame(dis) {
      // console.log(dis)
      if (dis !== undefined) {
        // 编辑
        this.diNewDialogVisible = true;
        this.diNewForm.diNewName = dis.name;
        this.newSecondNewKe = dis.twoLevelDeptNames[0];
        this.newPosition = dis.partId;
        this.diseaseId = dis.id;
        this.addEdit = 1;
      } else {
        this.diNewDialogVisible = true;
        this.addEdit = 0;
      }
    },
    // 添加编辑疾病最后执行
    disAddEidt() {
      if (this.addEdit == 0) {
        console.log('这是新增按钮');
        this.diseaseAdd();
      } else {
        conosle.log('这是编辑按钮');
        this.departEdit();
      }
    },
    // 添加疾病
    diseaseAdd() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          let addDisease = {
            partId: this.newPosition,
            name: this.diNewForm.diNewName,
            twoLevelDeptIds: this.newSecondNewKe
          }
          let that = this;
          console.log(addDisease)
          API.addDisease(addDisease).then(function(result) {
            console.log(result)
            if (result.status != '0') {
              that.$message.error({
                showClose: true,
                message: result.message.toString(),
                duration: 2000
              });
              return;
            }
            that.searchBean.pageNum = 1;
            that.loadPage()
            that.$message.success('添加疾病成功');
          }, function(err) {
            that.$message.error({
              showClose: true,
              message: err.message.toString(),
              duration: 2000
            });
          }).catch(function(err) {
            that.$message.error({
              showClose: true,
              message: err.message.toString(),
              duration: 2000
            });
          })
        } else {
          return false;
        }
      })
    },
    // 编辑疾病
    diseaseEdit() {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          let editDisease = {
            id: this.diseaseId,
            partId: this.newPosition,
            name: this.diNewForm.diNewName,
            twoLevelDeptIds: this.newSecondNewKe
          }
          let that = this;
          API.editDisease(editDisease).then(function(result) {
            console.log(result)
            if (result.status != '0') {
              that.$message.error({
                showClose: true,
                message: result.message.toString(),
                duration: 2000
              });
              return;
            }
            that.searchBean.pageNum = 1;
            that.loadPage()
            that.$message.success('编辑疾病成功');
          }, function(err) {
            that.$message.error({
              showClose: true,
              message: err.message.toString(),
              duration: 2000
            });
          }).catch(function(err) {
            that.$message.error({
              showClose: true,
              message: err.message.toString(),
              duration: 2000
            });
          })
        } else {
          return false;
        }
      })
    },
    // 疾病删除
    diseaseDelete(diseaseId) {
      let deId = 	{
        diseaseId: diseaseId
      }
      console.log(deId)
      let that = this;
      API.deleteDisease(deId).then(function(result) {
        // console.log(result)
        if (result.status == 0) {
          // 删除成功 重新加载数据
          that.searchBean.pageNum = 1
          that.loadPage()
          that.$message({
            type: 'success',
            message: '删除成功'
          })
        } else {
          that.$message.error({
            showClose: true,
            message: err.message.toString(),
            duration: 2000
          });
        }
      }).catch(function(err) {
        // console.log(error)
        that.$message.error({
          showClose: true,
          message: err.message.toString(),
          duration: 2000
        });
      })
    },
    // 第一个弹框中的添加科室
    addDepart() {
      let domainLength = this.twoLevelDeptIds.length;
      console.log(domainLength)
      if (domainLength == 4) {
        return this.$message.error('最多只能添加五项');
      }
      this.twoLevelDeptIds.push({
        value: '',
        key: Date.now()
      });
    },
    // 删除科室
    deDepart(item) {
      var index = this.twoLevelDeptIds.indexOf(item);
      this.twoLevelDeptIds.splice(index, 1);
    },
    // 查询一级科室列表
    oneDepartList() {
      let obj = {
        pageSize: 100000,
        pageNum: 1
      }
      let that = this;
      API.queryOneLevelDeptList(obj).then(function(result) {
        // console.log(result.data.list)
        // departmentNewForm.firstKe

        result.data.list.forEach(item => {
          that.diNewForm.firstNewKe.push({
            value: item.id,
            label: item.name
          })
          that.diForm.depFirstKe.push({
            value: item.id,
            label: item.name
          })
          let {twoLevelDept} = item;
          // console.log(twoLevelDept)
        })
      })
    },
    // 失焦点搜索
    blur() {
      let that = this;
      let obj = {
        name: this.diNewDe.newNames
      }
      API.searchSymptomByPage(obj).then(function(result) {
        that.seconedGoodSympton = [];
        result.data.list.forEach(item => {
          that.seconedGoodSympton.push(item);
        })
      }).catch()
    },
    // 弹框中的症状(查询)
    symptom() {
      let that = this;
      let searchBean = {
        pageNum: 1,
        pageSize: 1000000000
      }
      API.searchSymptomByPage(searchBean).then(function(result) {
        // console.log(result);
        result.data.list.forEach(item => {
          that.seconedGoodSympton.push(item);
        })
        console.log(that.seconedGoodSympton)
      }).catch()
    },
    // 新增症状
    addSecondDis() {
      this.diSecondDialog = false;
    },
    // 第一个弹框中的查询二级科室
    firstTwoTan() {
      let obj = {
        oneLevelDeptId: this.newFirstKe
      }
		    let that = this;
		   	API.deptQueryList(obj).then(function(result) {
				 console.log(result)
				 result.data.list.forEach(item => {
					 that.diNewForm.secondNewKe = [];
					 that.diNewForm.secondNewKe.push({
						 value: item.twoLevelDeptId,
						 label: item.twoLevelDeptName
					 })
				 })
      })
    },
    ///
    // 第二个弹框中的onChange
    seconedChange(item) {
      // console.log(id)
      // 将变化的值给了diseaseIdName,通过点击添加传给1,1在有一个onChange事件获取选中的id，赋给goodAt即可
      let index = this.diseaseIdName.indexOf(item);
      if (index == -1) {
        this.diseaseIdName.push(item);
      } else {
        this.diseaseIdName.splice(index, 1);
      }
      console.log(this.diseaseIdName)
    },
    // 添加疾病 第二个弹框确定，吧擅长疾病赋值给第一个弹框准备的数组中
    addDepartDis() {
      this.diseaseIdName.forEach(item => {
        this.firstGoodDisease.push({
          name: item.name,
          id: item.id
        })
      })
      this.firstGoodDisease.forEach(item => {
        this.diseases.push(item.id);
      })
      console.log(this.firstGoodDisease)
      console.log(this.diseases);
      this.diSecondDialog = false
      this.seconedSyCheckList = [];
      this.diNewDe.newNames = ''
    },
    // 点第一个框中的添加获取疾病列表
    firstAdd() {
      this.diSecondDialog = true;
      this.symptom();
    },
    // 第一个弹框中的change事,变成选中准态，删除项
    firstChange(item) {
      // console.log(item)
      this.deleteName.push(item);
      this.deleteId.push(item.id);
      console.log(this.deleteId)
      console.log(this.deleteName)
    },
    // 第一个弹框中的科室疾病删除，将删除项在firstGoodDisease中删除
    dtRemove() {
      this.firstGoodDisease.map((item, index) => {
        if (this.deleteName.indexOf(item) !== -1) {
          console.log(item, index)
          this.firstGoodDisease.splice(index, 1);
        }
      })
      console.log(this.firstGoodDisease);
      this.diseases.map((item, index) => {
        if (this.deleteId.indexOf(item) !== -1) {
          this.diseases.splice(index, 1)
        }
      })
      console.log(this.diseases)
    }

  }
}
</script>
<style scoped>
.el-dialog__wrapper{
  /* z-index: 2300!important; */
}
.newDisease .el-dialog__wrapper:last-child{
  /* right: -859px;
  position: none; */
}
</style>
